use std::sync::Arc;
use crate::{
    abstractions::{data::Data, task::TaskAbstraction}, error::ServerError, protocol::{datatypes::SYSTEM_DATA_TYPE, task::SymbolicTask, type_schema::TypeSchema},
};
use super::stimulus_extraction_impl::*;
    
pub struct BuiltinStimulusExtraction {
    pub name: String,
    pub description: String,
    pub light_detection: SymbolicTask,
    pub param_user_input: SymbolicTask,
}

impl BuiltinStimulusExtraction {
    pub fn new() -> Self {
        Self {
            name: "BuiltinStimulusExtraction".into(),
            description: "用于提取闪光刺激".into(),
            light_detection: SymbolicTask::new("light_detection".into(), TypeSchema::from_str("(FilePath, ?Int)"), TypeSchema::from_str("List<Int>")),
            param_user_input: SymbolicTask::new("param_user_input".into(), TypeSchema::from_str("Void"), TypeSchema::from_str("(Bool, Int, Int)")),
        }
    }

    pub fn light_detection(&self) -> Arc<TaskAbstraction> {
        let input_type = self.light_detection.input_type.clone();
        let output_type = self.light_detection.output_type.clone();
        return Arc::new(TaskAbstraction::Builtin("light_detection".into(), input_type, output_type, Arc::new(extract_stimulus_func)))
    }
}
